import {baseUrl} from '../config/index'
export const $request = (params = {}) => {
   return new Promise((resolve, reject) => {
    wx.showLoading({
      title: '加载中',
    })
     wx.request({
      //  
       url: baseUrl + params.url || '',
       method: params.method || '',
       data: params.data || {},
       header: params.header|| {},
       success(res){
        resolve(res.data)
       },
       fail(err){
        reject(err)
       },
       complete(){
          wx.hideLoading({
            success: (res) => {},
          })
       }
     })
   })
}

